/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/11
\**********************/
#include "LuaControl.h"

#define CObjPtr ((CControlUI*)m_cobj)

namespace DuiLib {

int LuaControl::SetEvent(LuaState *L)
{
    LuaStack args(L);
    //cause RegisterObjectFunctor,the first param must be args[2]
    bool bRet = false;
    if (args[2].IsString() && args[3].IsFunction()){
        bRet = LuaHelperNS::SetEventToObjs(L, m_cobj, args[2].GetString(), args[3]);
    }
    L->PushBoolean(bRet);
    return 1;
}

int LuaControl::RemoveEvent(LuaState *L)
{
    LuaStack args(L);
    //cause RegisterObjectFunctor,the first param must be args[2]
    if (args[2].IsString()){
        LuaHelperNS::RemoveEventFromObjs(L, m_cobj, args[2].GetString());
    }
    return 0;
}

int LuaControl::GetName(LuaState *L)
{
    SDTString name = CObjPtr->GetName().GetData();
    LuaHelperNS::PushTString(L, name);
    return 1;
}

int LuaControl::SetName(LuaState *L)
{
    LuaStack args(L);
    SDTString name = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetName(name.c_str());
    return 0;
}

/*int LuaControl::GetClass(LuaState *L)
{
    SDTString str = CObjPtr->GetClass();
    LuaHelperNS::PushTString(L, str);
    return 1;
}*/

bool LuaControl::Activate()
{
    return CObjPtr->Activate();
}

int LuaControl::Window(LuaState *L)
{
    SDWindow* wnd = SDPtr->FindWindow(CObjPtr->GetManager());
    LuaHelperNS::PushCObj(L, wnd);
    return 1;
}

int LuaControl::GetParent(LuaState *L)
{
    CControlUI* ctrl = CObjPtr->GetParent();
    LuaHelperNS::PushCObj(L, ctrl);
    return 1;
}

bool LuaControl::SetTimer(UINT nTimerID, UINT nElapse)
{
    return CObjPtr->SetTimer(nTimerID, nElapse);
}

void LuaControl::KillTimer(UINT nTimerID)
{
    CObjPtr->KillTimer(nTimerID);
}

int LuaControl::GetText(LuaState *L)
{
    SDTString str = CObjPtr->GetText().GetData();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetText(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetText(str.c_str());
    return 0;
}

bool LuaControl::IsResourceText()
{
    return CObjPtr->IsResourceText();
}

void LuaControl::SetResourceText(bool bResource)
{
    CObjPtr->SetResourceText(bResource);
}

bool LuaControl::IsDragEnabled()
{
    return CObjPtr->IsDragEnabled();
}

void LuaControl::SetDragEnable(bool bDrag)
{
    CObjPtr->SetDragEnable(bDrag);
}

bool LuaControl::IsDropEnabled()
{
    return CObjPtr->IsDropEnabled();
}

void LuaControl::SetDropEnable(bool bDrop)
{
    CObjPtr->SetDropEnable(bDrop);
}

int LuaControl::GetGradient(LuaState *L)
{
    SDTString str = CObjPtr->GetGradient();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetGradient(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetGradient(str.c_str());
    return 0;
}

DWORD LuaControl::GetBkColor()
{
    return CObjPtr->GetBkColor();
}

void LuaControl::SetBkColor(DWORD dwBackColor)
{
    CObjPtr->SetBkColor(dwBackColor);
}

DWORD LuaControl::GetBkColor2()
{
    return CObjPtr->GetBkColor2();
}

void LuaControl::SetBkColor2(DWORD dwBackColor)
{
    CObjPtr->SetBkColor2(dwBackColor);
}

DWORD LuaControl::GetBkColor3()
{
    return CObjPtr->GetBkColor3();
}

void LuaControl::SetBkColor3(DWORD dwBackColor)
{
    CObjPtr->SetBkColor3(dwBackColor);
}

DWORD LuaControl::GetForeColor()
{
    return CObjPtr->GetForeColor();
}

void LuaControl::SetForeColor(DWORD dwForeColor)
{
    CObjPtr->SetForeColor(dwForeColor);
}

int LuaControl::GetBkImage(LuaState *L)
{
    SDTString str = CObjPtr->GetBkImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetBkImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetBkImage(str.c_str());
    return 0;
}

int LuaControl::GetForeImage(LuaState *L)
{
    SDTString str = CObjPtr->GetForeImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetForeImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetForeImage(str.c_str());
    return 0;
}

DWORD LuaControl::GetFocusBorderColor()
{
    return CObjPtr->GetFocusBorderColor();
}

void LuaControl::SetFocusBorderColor(DWORD dwBorderColor)
{
    CObjPtr->SetFocusBorderColor(dwBorderColor);
}

bool LuaControl::IsColorHSL()
{
    return CObjPtr->IsColorHSL();
}

void LuaControl::SetColorHSL(bool bColorHSL)
{
    CObjPtr->SetColorHSL(bColorHSL);
}

int LuaControl::GetBorderRound(LuaState *L)
{
    SIZE sz = CObjPtr->GetBorderRound();
    LuaHelperNS::PushSize(L, sz);
    return 1;
}

int LuaControl::SetBorderRound(LuaState *L)
{
    LuaStack args(L);
    SIZE sz = LuaHelperNS::GetSize(args[2]);
    CObjPtr->SetBorderRound(sz);
    return 0;
}

int LuaControl::GetBorderSize()
{
    return CObjPtr->GetBorderSize();
}

int LuaControl::SetBorderSize(LuaState *L)
{
    LuaStack args(L);
    if (args[2].IsInteger()) {
        CObjPtr->SetBorderSize(args[2].GetInteger());
    } else {
        RECT rc = LuaHelperNS::GetRect(args[2]);
        CObjPtr->SetBorderSize(rc);
    }
    return 0;
}

DWORD LuaControl::GetBorderColor()
{
    return CObjPtr->GetBorderColor();
}

void LuaControl::SetBorderColor(DWORD dwBorderColor)
{
    CObjPtr->SetBorderColor(dwBorderColor);
}

int LuaControl::GetLeftBorderSize()
{
    return CObjPtr->GetLeftBorderSize();
}

void LuaControl::SetLeftBorderSize(int nSize)
{
    CObjPtr->SetLeftBorderSize(nSize);
}

int LuaControl::GetTopBorderSize()
{
    return CObjPtr->GetTopBorderSize();
}

void LuaControl::SetTopBorderSize(int nSize)
{
    CObjPtr->SetTopBorderSize(nSize);
}

int LuaControl::GetRightBorderSize()
{
    return CObjPtr->GetRightBorderSize();
}

void LuaControl::SetRightBorderSize(int nSize)
{
    CObjPtr->SetRightBorderSize(nSize);
}

int LuaControl::GetBottomBorderSize()
{
    return CObjPtr->GetBottomBorderSize();
}

void LuaControl::SetBottomBorderSize(int nSize)
{
    CObjPtr->SetBottomBorderSize(nSize);
}

int LuaControl::GetBorderStyle()
{
    return CObjPtr->GetBorderStyle();
}

void LuaControl::SetBorderStyle(int nStyle)
{
    CObjPtr->SetBorderStyle(nStyle);
}

int LuaControl::GetRelativePos(LuaState *L)
{
    RECT rc = CObjPtr->GetRelativePos();
    LuaHelperNS::PushRect(L, rc);
    return 1;
}

int LuaControl::GetClientPos(LuaState *L)
{
    RECT rc = CObjPtr->GetClientPos();
    LuaHelperNS::PushRect(L, rc);
    return 1;
}

int LuaControl::GetPos(LuaState *L)
{
    RECT rc = CObjPtr->GetPos();
    LuaHelperNS::PushRect(L, rc);
    return 1;
}

int LuaControl::SetPos(LuaState *L)
{
    LuaStack args(L);
    RECT rc = LuaHelperNS::GetRect(args[2]);
    bool bNeedInvalidate = LuaHelperNS::GetBool(args[3], true);
    CObjPtr->SetPos(rc, bNeedInvalidate);
    return 0;
}

int LuaControl::Move(LuaState *L)
{
    LuaStack args(L);
    SIZE sz = LuaHelperNS::GetSize(args[2]);
    bool bNeedInvalidate = LuaHelperNS::GetBool(args[3], true);
    CObjPtr->Move(sz, bNeedInvalidate);
    return 0;
}

int LuaControl::GetWidth()
{
    return CObjPtr->GetWidth();
}

int LuaControl::GetHeight()
{
    return CObjPtr->GetHeight();
}

int LuaControl::GetX()
{
    return CObjPtr->GetX();
}

int LuaControl::GetY()
{
    return CObjPtr->GetY();
}

int LuaControl::GetPadding(LuaState *L)
{
    RECT rc = CObjPtr->GetPadding();
    LuaHelperNS::PushRect(L, rc);
    return 1;
}

int LuaControl::SetPadding(LuaState *L)
{
    LuaStack args(L);
    RECT rc = LuaHelperNS::GetRect(args[2]);
    CObjPtr->SetPadding(rc);
    return 0;
}

int LuaControl::GetFixedXY(LuaState *L)
{
    SIZE sz = CObjPtr->GetFixedXY();
    LuaHelperNS::PushSize(L, sz);
    return 1;
}

int LuaControl::SetFixedXY(LuaState *L)
{
    LuaStack args(L);
    SIZE sz = LuaHelperNS::GetSize(args[2]);
    CObjPtr->SetFixedXY(sz);
    return 0;
}

int LuaControl::GetFixedWidth()
{
    return CObjPtr->GetFixedWidth();
}

void LuaControl::SetFixedWidth(int cx)
{
    CObjPtr->SetFixedWidth(cx);
}

int LuaControl::GetFixedHeight()
{
    return CObjPtr->GetFixedHeight();
}

void LuaControl::SetFixedHeight(int cy)
{
    CObjPtr->SetFixedHeight(cy);
}

int LuaControl::GetMinWidth()
{
    return CObjPtr->GetMinWidth();
}

void LuaControl::SetMinWidth(int cx)
{
    CObjPtr->SetMinWidth(cx);
}

int LuaControl::GetMaxWidth()
{
    return CObjPtr->GetMaxWidth();
}

void LuaControl::SetMaxWidth(int cx)
{
    CObjPtr->SetMaxWidth(cx);
}

int LuaControl::GetMinHeight()
{
    return CObjPtr->GetMinHeight();
}

void LuaControl::SetMinHeight(int cy)
{
    CObjPtr->SetMinHeight(cy);
}

int LuaControl::GetMaxHeight()
{
    return CObjPtr->GetMaxHeight();
}

void LuaControl::SetMaxHeight(int cy)
{
    CObjPtr->SetMaxHeight(cy);
}

void LuaControl::SetFloatAlign(UINT uAlign)
{
    CObjPtr->SetFloatAlign(uAlign);
}

UINT LuaControl::GetFloatAlign()
{
    return CObjPtr->GetFloatAlign();
}

int LuaControl::GetToolTip(LuaState *L)
{
    SDTString str = CObjPtr->GetToolTip().GetData();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetToolTip(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetToolTip(str.c_str());
    return 0;
}

void LuaControl::SetToolTipWidth(int nWidth)
{
    CObjPtr->SetToolTipWidth(nWidth);
}

int	 LuaControl::GetToolTipWidth(void)
{
    return CObjPtr->GetToolTipWidth();
}

WORD LuaControl::GetCursor()
{
    return CObjPtr->GetCursor();
}

void LuaControl::SetCursor(WORD wCursor)
{
    CObjPtr->SetCursor(wCursor);
}

int LuaControl::GetShortcut(LuaState *L)
{
    SDTChar val = CObjPtr->GetShortcut();
    LuaHelperNS::PushTChar(L, val);
    return 1;
}

int LuaControl::SetShortcut(LuaState *L)
{
    LuaStack args(L);
    SDTChar val = LuaHelperNS::GetTChar(args[2]);
    CObjPtr->SetShortcut(val);
    return 0;
}

bool LuaControl::IsContextMenuUsed()
{
    return CObjPtr->IsContextMenuUsed();
}

void LuaControl::SetContextMenuUsed(bool bMenuUsed)
{
    CObjPtr->SetContextMenuUsed(bMenuUsed);
}

int LuaControl::GetUserData(LuaState *L)
{
    SDTString str = CObjPtr->GetUserData().GetData();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetUserData(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetUserData(str.c_str());
    return 0;
}

UINT_PTR LuaControl::GetTag()
{
    return CObjPtr->GetTag();
}

void LuaControl::SetTag(UINT_PTR pTag)
{
    CObjPtr->SetTag(pTag);
}

bool LuaControl::IsVisible()
{
    return CObjPtr->IsVisible();
}

void LuaControl::SetVisible(bool bVisible)
{
    CObjPtr->SetVisible(bVisible);
}

void LuaControl::SetInternVisible(bool bVisible)
{
    CObjPtr->SetInternVisible(bVisible);
}

bool LuaControl::IsEnabled()
{
    return CObjPtr->IsEnabled();
}

void LuaControl::SetEnabled(bool bEnable)
{
    CObjPtr->SetEnabled(bEnable);
}

bool LuaControl::IsMouseEnabled()
{
    return CObjPtr->IsMouseEnabled();
}

void LuaControl::SetMouseEnabled(bool bEnable)
{
    CObjPtr->SetMouseEnabled(bEnable);
}

bool LuaControl::IsKeyboardEnabled()
{
    return CObjPtr->IsKeyboardEnabled();
}

void LuaControl::SetKeyboardEnabled(bool bEnable)
{
    CObjPtr->SetKeyboardEnabled(bEnable);
}

bool LuaControl::IsFocused()
{
    return CObjPtr->IsFocused();
}

void LuaControl::SetFocus()
{
    CObjPtr->SetFocus();
}

bool LuaControl::IsFloat()
{
    return CObjPtr->IsFloat();
}

void LuaControl::SetFloat(bool bFloat)
{
    CObjPtr->SetFloat(bFloat);
}

void LuaControl::Invalidate()
{
    CObjPtr->Invalidate();
}

DWORD LuaControl::GetAdjustColor(DWORD dwColor)
{
    return CObjPtr->GetAdjustColor(dwColor);
}

int LuaControl::EstimateSize(LuaState *L)
{
    LuaStack args(L);
    SIZE szAvailable = LuaHelperNS::GetSize(args[2]);
    SIZE sz = CObjPtr->EstimateSize(szAvailable);
    LuaHelperNS::PushSize(L, sz);
    return 1;
}

int LuaControl::GetVirtualWnd(LuaState *L)
{
    SDTString str = CObjPtr->GetVirtualWnd().GetData();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaControl::SetVirtualWnd(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetVirtualWnd(str.c_str());
    return 0;
}

SDLUA_BEGIN_REGISTER_BASE(LuaControl, Control)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetEvent, SetEvent)
    SDLUA_REGISTER_FUN_LUA(LuaControl, RemoveEvent, RemoveEvent)

    SDLUA_REGISTER_FUN_LUA(LuaControl, GetName, GetName)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetName, SetName)
    //SDLUA_REGISTER_FUN_LUA(LuaControl, GetClass, GetClass)
    SDLUA_REGISTER_FUN_CPP(LuaControl, Activate, Activate)
    SDLUA_REGISTER_FUN_LUA(LuaControl, Window, Window)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetParent, GetParent)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetTimer, SetTimer)
    SDLUA_REGISTER_FUN_CPP(LuaControl, KillTimer, KillTimer)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetText, GetText)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetText, SetText)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsResourceText, IsResourceText)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetResourceText, SetResourceText)

    SDLUA_REGISTER_FUN_CPP(LuaControl, IsDragEnabled, IsDragEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetDragEnable, SetDragEnable)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsDropEnabled, IsDropEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetDropEnable, SetDropEnable)

    SDLUA_REGISTER_FUN_LUA(LuaControl, GetGradient, GetGradient)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetGradient, SetGradient)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBkColor, GetBkColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetBkColor, SetBkColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBkColor2, GetBkColor2)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetBkColor2, SetBkColor2)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBkColor3, GetBkColor3)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetBkColor3, SetBkColor3)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetForeColor, GetForeColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetForeColor, SetForeColor)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetBkImage, GetBkImage)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetBkImage, SetBkImage)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetForeImage, GetForeImage)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetForeImage, SetForeImage)

    SDLUA_REGISTER_FUN_CPP(LuaControl, GetFocusBorderColor, GetFocusBorderColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetFocusBorderColor, SetFocusBorderColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsColorHSL, IsColorHSL)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetColorHSL, SetColorHSL)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetBorderRound, GetBorderRound)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetBorderRound, SetBorderRound)

    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBorderSize, GetBorderSize)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetBorderSize, SetBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBorderColor, GetBorderColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetBorderColor, SetBorderColor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetLeftBorderSize, GetLeftBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetLeftBorderSize, SetLeftBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetTopBorderSize, GetTopBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetTopBorderSize, SetTopBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetRightBorderSize, GetRightBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetRightBorderSize, SetRightBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBottomBorderSize, GetBottomBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetBottomBorderSize, SetBottomBorderSize)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetBorderStyle, GetBorderStyle)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetBorderStyle, SetBorderStyle)

    SDLUA_REGISTER_FUN_LUA(LuaControl, GetRelativePos, GetRelativePos)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetClientPos, GetClientPos)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetPos, GetPos)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetPos, SetPos)
    SDLUA_REGISTER_FUN_LUA(LuaControl, Move, Move)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetWidth, GetWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetHeight, GetHeight)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetX, GetX)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetY, GetY)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetPadding, GetPadding)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetPadding, SetPadding)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetFixedXY, GetFixedXY)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetFixedXY, SetFixedXY)

    SDLUA_REGISTER_FUN_CPP(LuaControl, GetFixedWidth, GetFixedWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetFixedWidth, SetFixedWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetFixedHeight, GetFixedHeight)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetFixedHeight, SetFixedHeight)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetMinWidth, GetMinWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetMinWidth, SetMinWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetMaxWidth, GetMaxWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetMaxWidth, SetMaxWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetMinHeight, GetMinHeight)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetMinHeight, SetMinHeight)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetMaxHeight, GetMaxHeight)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetMaxHeight, SetMaxHeight)

    SDLUA_REGISTER_FUN_CPP(LuaControl, SetFloatAlign, SetFloatAlign)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetFloatAlign, GetFloatAlign)
    
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetToolTip, GetToolTip)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetToolTip, SetToolTip)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetToolTipWidth, SetToolTipWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetToolTipWidth, GetToolTipWidth)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetCursor, GetCursor)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetCursor, SetCursor)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetShortcut, GetShortcut)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetShortcut, SetShortcut)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsContextMenuUsed, IsContextMenuUsed)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetContextMenuUsed, SetContextMenuUsed)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetUserData, GetUserData)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetUserData, SetUserData)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetTag, GetTag)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetTag, SetTag)

    SDLUA_REGISTER_FUN_CPP(LuaControl, IsVisible, IsVisible)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetVisible, SetVisible)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetInternVisible, SetInternVisible)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsEnabled, IsEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetEnabled, SetEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsMouseEnabled, IsMouseEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetMouseEnabled, SetMouseEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsKeyboardEnabled, IsKeyboardEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetKeyboardEnabled, SetKeyboardEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsFocused, IsFocused)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetFocus, SetFocus)
    SDLUA_REGISTER_FUN_CPP(LuaControl, IsFloat, IsFloat)
    SDLUA_REGISTER_FUN_CPP(LuaControl, SetFloat, SetFloat)
    SDLUA_REGISTER_FUN_CPP(LuaControl, Invalidate, Invalidate)
    SDLUA_REGISTER_FUN_CPP(LuaControl, GetAdjustColor, GetAdjustColor)

    SDLUA_REGISTER_FUN_LUA(LuaControl, EstimateSize, EstimateSize)
    SDLUA_REGISTER_FUN_LUA(LuaControl, SetVirtualWnd, SetVirtualWnd)
    SDLUA_REGISTER_FUN_LUA(LuaControl, GetVirtualWnd, GetVirtualWnd)
SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaControl, Control)
SDLUA_END_UNREGISTER(Control)

}

#undef CObjPtr